package com.winexpress.product;

import com.winexpress.session.product.RatingMessage;
import com.winexpress.session.product.RatingSessionBean;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

@WebService(serviceName = "RatingManagementWS")
public class RatingManagementWS {

    @EJB
    RatingSessionBean ratingSessionBean;

    @WebMethod(operationName = "addRating")
    public Long addRating(@WebParam(name = "inMessage") RatingMessage inMessage) {
        return ratingSessionBean.createRating(inMessage);
    }

    @WebMethod(operationName = "getAverageRating")
    public double getAverageRating(@WebParam(name = "wid") long wid) {
        return ratingSessionBean.getAverageRating(wid);
    }
}
